/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Prueba.java
 *
 * Created on 23/07/2011, 09:23:06 AM
 */

package co.srm.vistas.funcionales;

import co.srm.entidades.Prestamo;
import co.srm.entidades.Prestamo.EstadoActual;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;

/**
 *
 * @author TilZon
 */
public class Prueba extends javax.swing.JFrame {

    /** Creates new form Prueba */
    public Prueba() {
        initComponents();
        ComboBoxModel cbModel = new DefaultComboBoxModel(Prestamo.EstadoActual.values());
        enumOpcion.setModel(cbModel);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        enumOpcion = new javax.swing.JComboBox();
        jLabel1 = new javax.swing.JLabel();
        opcion = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        enumOpcion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                enumOpcionActionPerformed(evt);
            }
        });

        jLabel1.setText("Opciones Enum");

        jLabel2.setText("Seleccionado");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(37, 37, 37)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel1)
                    .addComponent(jLabel2))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(opcion, javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(enumOpcion, javax.swing.GroupLayout.Alignment.LEADING, 0, 143, Short.MAX_VALUE))
                .addContainerGap(129, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(72, 72, 72)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(enumOpcion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(opcion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2))
                .addContainerGap(24, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void enumOpcionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_enumOpcionActionPerformed
        // TODO add your handling code here:
        opcion.setText(enumOpcion.getSelectedItem().toString());
        Prestamo.EstadoActual estado=(Prestamo.EstadoActual) enumOpcion.getSelectedItem();

    }//GEN-LAST:event_enumOpcionActionPerformed

    /**
    * @param args the command line arguments
    */
//    public static void main(String args[]) {
//        java.awt.EventQueue.invokeLater(new Runnable() {
//            public void run() {
//                new Prueba().setVisible(true);
//            }
//        });
//    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JComboBox enumOpcion;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JTextField opcion;
    // End of variables declaration//GEN-END:variables

}
